/**
 * jquery plugins fullcalendar
 */
(function() {
	'use strick',
	
	require.config({
		paths: {
			"jquery.fullcalendar": "miwawa/1.0.2/js/jquery/fullcalendar/2.6.0/js/fullcalendar.min",
			"jquery.fullcalendar.zh-CN": "miwawa/1.0.2/js/jquery/fullcalendar/2.6.0/js/lang/zh-cn",
		},
		shim: {
			"jquery.fullcalendar": {
				deps : ["css!miwawa/1.0.2/js/jquery/fullcalendar/2.6.0/css/fullcalendar.min.css"]
			},
			"jquery.fullcalendar.zh-CN": {deps : ["jquery.fullcalendar"]}
		}
	});
	
	define(['jquery.fullcalendar','jquery.fullcalendar.zh-CN'], function(){
		return function(options){
			jQuery("#external-events div.external-event").each(function() {
				jQuery(this).data("eventObject", {
					title : jQuery.trim(jQuery(this).text())
				});
				jQuery(this).draggable({
					zIndex : 999,
					revert : true,
					revertDuration : 0
				})
			});
			
			jQuery("#calendar").fullCalendar(jQuery.extend(true,{},{
				editable : true,
				droppable : true,
				header : {
					left : "prev,today,next",
					center : "title",
					right : "month,basicWeek,basicDay"
				}
			},options));
		};
	});
})(this);
